package org.testfire.support.io.properties;

import java.lang.reflect.Constructor;

/**
 * Created by IntelliJ IDEA.
 * User: granum
 * Date: Sep 14, 2007
 * Time: 1:27:27 PM
 */
public class PropertyTranslator<T>
{
	public static final PropertyTranslator instance = new PropertyTranslator();

	public String toPropertyString(T o){
		return String.valueOf(o);
	}

	public T toObject(Class<T> clazz, String string) throws Exception
	{
			Constructor c = clazz.getConstructor(String.class);
			return (T) c.newInstance(string);

	}
}
